<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="com.nanterre.annuaire.bd.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    // Create ArrayList and add some items
    response.setContentType("text/html;charset=UTF-8");
    List<String> listLibelleTotal = new ArrayList<String>();
    List<String> listLibelle = new ArrayList<String>();
        String textToFind = request.getParameter("recherche");
        String critere = request.getParameter("critere");
        BDInteraction bdi = new BDInteraction();
        Oracle o = new Oracle();
        o.logIn();
        listLibelleTotal = bdi.getLibelleByTypeElement(critere);
        HashMap<String, String> map = new HashMap<String, String>();
        for(String current : listLibelleTotal)
            map.put(current, "ok");
        Set set = map.keySet();
        Iterator it = set.iterator();
        while(it.hasNext())
            listLibelle.add((String)it.next());
        Collections.sort(listLibelle); 
        for(String currentLibelle : listLibelle){
            if(currentLibelle.toLowerCase().contains(textToFind.toLowerCase())){
                out.println(currentLibelle);
            }
        }
%>
